package com.wchat.converter;

import com.fasterxml.jackson.databind.util.BeanUtil;
import com.wchat.dataobject.OrderMaster;
import com.wchat.dto.OrderDto;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by yangtianrui on 17/8/12.
 */
public class OrderMaster2OrderDtoVConverter {

    public static OrderDto converter(OrderMaster orderMaster)
    {
       OrderDto  orderDto = new OrderDto();
       BeanUtils.copyProperties(orderMaster,orderDto);// 属性拷贝
       return orderDto;
    }

    public static List<OrderDto> converter(List<OrderMaster> orderMasterList)
    {
      return  orderMasterList.stream().map(e -> converter(e)).collect(Collectors.toList());
    }

}

